﻿Imports QueComer

Public Class GestionRestauranteForm

    Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click

    End Sub

    Private Sub btnBuscar_Click99(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBuscar99.Click
        Dim nombre As String = Me.xnombre.Text
        Dim tipo_comida As String = Me.xespe.Text
        Dim distrito As String = Me.xdistrito.Text
        Dim direccion As String = Me.xdirec.Text
        Dim ruc As String = Me.xruc.Text

        Dim negocio As New Buscar
        Dim cat As Collection = negocio.buscartodo(nombre, tipo_comida, distrito, direccion, ruc)
        Me.dgvplop.DataSource = cat
        Me.dgvplop.EditMode = False

    End Sub

    Private Sub MaskedTextBox1_MaskInputRejected(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MaskInputRejectedEventArgs) Handles xdirec.MaskInputRejected

    End Sub

    Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.Click

    End Sub

    Private Sub btnNuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNuevo.Click
        Dim form As New NuevoRestaurantForm
        form.MdiParent = Me.MdiParent
        form.GestionRestauranteForm = Me
        form.Show()
    End Sub

    Private Sub btnEditar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEditar.Click
        Try
            Dim seleccionado = Me.dgvplop.CurrentRow.Cells(0).Value.ToString
            Dim form As New NuevoRestaurantForm
            form.MdiParent = Me.MdiParent
            form.lblId.Text = seleccionado
            form.GestionRestauranteForm = Me
            form.Show()
        Catch ex As Exception
            Me.lblError.Text = "No ha seleccionado ningún restaurante"
        End Try
    End Sub

    Private Sub btnEliminar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEliminar.Click
        Try
            Dim seleccionado = Me.dgvplop.CurrentRow.Cells(0).Value.ToString
            Dim negocio As New Gestion_Rest
            negocio.eliminar(seleccionado)
            dgvplop.DataSource = ""
        Catch ex As Exception
            Me.lblError.Text = "No ha seleccionado ningún restaurante"
        End Try
    End Sub

    Private Sub dgvplop_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvplop.CellContentClick

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim form As New NuevoRestaurantForm
        form.MdiParent = Me.MdiParent
        form.GestionRestauranteForm = Me
        form.Show()
    End Sub

    Private Sub GestionRestauranteForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter

    End Sub
End Class